Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughSelectLineScreen.tsxのlineSelection関連メソッドにおいて、pendingStationおよびpendingStationsの状態管理フローが改変されました。handleLineSelectedとopenModalByLineIdの両メソッドで、ステーション情報をクリアしてから再度フェッチして再入力する2段階更新パターンが導入されました。 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/screens/SelectLineScreen.tsx (1)
565-596:⚠️ Potential issue | 🟠 Major最新のリクエストのみを反映させるガードが必要
Line 584-596 の非同期フェッチ中に再度カード選択されると、古いレスポンスで状態が上書きされる可能性があります。
fetchStationsByLineIdLoadingが true のときはスケルトンで保護されますが、フェッチ完了後に再び CommonCard が表示される際、CommonCard のloadingプロップは onPress を無効化しません。そのため以下のシナリオが発生します:
- 線A を選択 → フェッチ開始
- フェッチ完了 →
fetchStationsByLineIdLoadingが false に- CommonCard 再表示(モーダル開いたまま)
- 線B を選択 → 別フェッチ開始
- 線B のレスポンスが後に到着 → 線A のデータを上書き
Line 592-596 の状態更新時に
lineIdの一致をチェックするか、フェッチ中はカードへのタップを無効化する対策を検討してください。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/screens/SelectLineScreen.tsx` around lines 565 - 596, Save the current requested lineId into a local variable before calling fetchStationsByLineId (e.g. const requestLineId = lineId) and after the await return, check that the response matches the latest selected line (compare requestLineId to the current pending/selected line id from state, e.g. lineState.pendingLine?.id or stationState.pendingStation?.lineId) and abort setting pendingStation/pendingStations if they differ; alternatively also disable CommonCard onPress while fetchStationsByLineIdLoading is true so taps are ignored during an ongoing fetch. Ensure you update the code around setLineState, fetchStationsByLineId and the setStationState block to perform this guard.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/screens/SelectLineScreen.tsx`:
- Around line 565-596: Save the current requested lineId into a local variable
before calling fetchStationsByLineId (e.g. const requestLineId = lineId) and
after the await return, check that the response matches the latest selected line
(compare requestLineId to the current pending/selected line id from state, e.g.
lineState.pendingLine?.id or stationState.pendingStation?.lineId) and abort
setting pendingStation/pendingStations if they differ; alternatively also
disable CommonCard onPress while fetchStationsByLineIdLoading is true so taps
are ignored during an ongoing fetch. Ensure you update the code around
setLineState, fetchStationsByLineId and the setStationState block to perform
this guard.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
Summary by CodeRabbit
リリースノート